﻿using FreeSql.DataAnnotations;
using System;

namespace KJSyncXP.Sqlite.Model
{
    /// <summary>
    /// 用户信息实体类（映射数据库表）
    /// </summary>
    [Table(Name = "User")] // 替换为实际表名
    public class User
    {
        /// <summary>
        /// 内部标识（主键、自增）
        /// </summary>
        [Column(IsPrimary = true, IsIdentity = true)]
        public int id { get; set; }

        /// <summary>
        /// 用户全局标识
        /// </summary>
        [Column(Name = "useruuid", DbType = "varchar(120)")]
        public string Useruuid { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Column(Name = "username", DbType = "varchar(60)")]
        public string Username { get; set; }

        /// <summary>
        /// 用户口令
        /// </summary>
        [Column(Name = "userpwd", DbType = "varchar(120)")]
        public string Userpwd { get; set; }

        /// <summary>
        /// 真实名称
        /// </summary>
        [Column(Name = "realname", DbType = "varchar(60)")]
        public string Realname { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        [Column(Name = "nickname", DbType = "varchar(60)")]
        public string Nickname { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [Column(Name = "remark", DbType = "varchar(120)")]
        public string Remark { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        [Column(Name = "deptname", DbType = "varchar(255)")]
        public string Deptname { get; set; } = "A";

        /// <summary>
        /// 在用?
        /// </summary>
        [Column(Name = "inuse")]
        public bool? Inuse { get; set; } // bit 类型对应 bool，表中允许为 null

        /// <summary>
        /// 状态
        /// </summary>
        [Column(Name = "state")]
        public int? State { get; set; }

        /// <summary>
        /// 班组
        /// </summary>
        [Column(Name = "usergroup", DbType = "varchar(50)")]
        public string Usergroup { get; set; }

        /// <summary>
        /// 登录时间
        /// </summary>
        [Column(Name = "logineddate", DbType = "datetime2")]
        public DateTime? Logineddate { get; set; } // datetime2 类型，表中允许为 null
    }
}